#!/usr/bin/node

const log = console.log;
const koa = require('koa'),
      Router = require('koa-router');

let router = new Router();

let app = new koa();

router.get('/api/tasks/',async(ctx,next) => {
  log('find');
  ctx.body='查询成功';
})

router.post('/api/tasks/',async (ctx,next)=>{
  log('add');
  ctx.body='添加成功'; 
})

router.put('/api/tasks/:id',async(ctx,next)=>{
  log('put');
  ctx.body='修改成功';
})

router.delete('/api/tasks/:id',async(ctx,next)=>{
  log('delete');
  ctx.body='删除成功';
})


app.use(router.routes());
app.listen(8080);

log('hello world');

